<<<<<<< HEAD
<!--  -->
<template>
  <el-container>
    <!-- 搜索框 -->
    <el-header>
      关键字:<el-input
        class="search"
        type="text"
        @change="selects()"
        placeholder="请输入站点名称"
        v-model="text"
      ></el-input>
    </el-header>
    <!-- 弹出框 -->
    <el-dialog
      class="psyModle"
      title="添加站点"
      :visible.sync="zhanDianAddVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXunSpan">站点名称 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点名称"
        v-model="zhanDianName"
      ></el-input>
      <span class="psChaXunSpan">站点电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="zhanDianPhone"
      ></el-input>
      <span class="psChaXunSpan">站点备用电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入备用电话"
        v-model="zhanDianPhone1"
      ></el-input>
      <span class="psChaXunSpan">站点地址 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点地址"
        v-model="zhanDianAddress"
      ></el-input>
      <span class="psChaXunSpan">常温品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品时效描述"
        v-model="zhanDianChangwenText"
      ></el-input>
      <span class="psChaXunSpan">常温品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品配送范围"
        v-model="ChangwenRang"
      ></el-input>
      <span class="psChaXunSpan">生鲜品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品时效描述"
        v-model="zhanDianShengxianText"
      ></el-input>
      <span class="psChaXunSpan">生鲜品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品配送范围"
        v-model="ShengxianRang"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianAddVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            zhanDianAddVisible = false;
            add();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="编辑站点"
      :visible.sync="zhanDianUPdataVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXunSpan">站点名称 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点名称"
        v-model="zhanDianName"
      ></el-input>
      <span class="psChaXunSpan">站点电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="zhanDianPhone"
      ></el-input>
      <span class="psChaXunSpan">站点备用电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入备用电话"
        v-model="zhanDianPhone1"
      ></el-input>
      <span class="psChaXunSpan">站点地址 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点地址"
        v-model="zhanDianAddress"
      ></el-input>
      <span class="psChaXunSpan">常温品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品时效描述"
        v-model="zhanDianChangwenText"
      ></el-input>
      <span class="psChaXunSpan">常温品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品配送范围"
        v-model="ChangwenRang"
      ></el-input>
      <span class="psChaXunSpan">生鲜品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品时效描述"
        v-model="zhanDianShengxianText"
      ></el-input>
      <span class="psChaXunSpan">生鲜品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品配送范围"
        v-model="ShengxianRang"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianUPdataVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            zhanDianUPdataVisible = false;
            updatas();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="查看信息"
      :visible.sync="zhanDianVisible"
      width="37%"
      top="50px"
      center
    >
      <el-descriptions title="站点信息" :column="2">
        <el-descriptions-item label="站点名称">{{ zhanDianName }}</el-descriptions-item>
        <el-descriptions-item label="站点电话">{{ zhanDianPhone }}</el-descriptions-item>
        <el-descriptions-item label="站点地址">{{ zhanDianAddress }}</el-descriptions-item>
        <el-descriptions-item label="常温品时效描述">{{
          zhanDianChangwenText
        }}</el-descriptions-item>
        <el-descriptions-item label="常温品配送范围">{{ ChangwenRang }}</el-descriptions-item>
        <el-descriptions-item label="生鲜品时效描述">{{
          zhanDianShengxianText
        }}</el-descriptions-item>
        <el-descriptions-item label="生鲜品配送范围">{{ ShengxianRang }}</el-descriptions-item>
      </el-descriptions>

      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianVisible = false">取 消</el-button>
        <el-button type="primary" @click="zhanDianVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 显示表 -->
    <el-main>
      <el-row>
        <el-button
          @click="
            zhanDianAddVisible = true;
            clears();
          "
          type="primary"
          title="添加"
          plain
          >添加</el-button
        >
        <el-button @click="batch()" type="danger" title="批量删除" plain>批量删除</el-button>
      </el-row>
      <Maintable :tableData="zhandianArr">
        <template v-slot:tableline>
          <el-table-column prop="site_name" label="站点名称" width="180"> </el-table-column>
          <el-table-column prop="site_address" label="地址" width="180"> </el-table-column>
          <el-table-column prop="site_phone" label="电话" width="180"> </el-table-column>
          <el-table-column prop="site_desc" label="描述" width="180"> </el-table-column>
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="success"
                slot="reference"
                plain
                title="查看"
                @click="
                  chakan(scope.row.site_id);
                  zhanDianVisible = true;
                "
                icon="el-icon-view"
              ></el-button>
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="
                  chakan(scope.row.site_id);
                  zhanDianUPdataVisible = true;
                "
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="psyDelBut(scope.row.site_id)"
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
    <el-footer>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[6, 8, 10, 12]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-footer>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainzhandian",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      size: 6,
      page: 1,
      total: 0,
      currentPage: 1,
      isChangwen: false,
      isShengxian: false,
      ChangwenRang: "",
      ShengxianRang: "",
      zhanDianName: "",
      zhanDianPhone: "",
      zhanDianPhone1: "",
      zhanDianAddress: "",
      zhanDianChangwenText: "",
      zhanDianShengxianText: "",
      zhanDianVisible: false,
      zhanDianAddVisible: false,
      zhanDianUPdataVisible: false,
      zhandianArr: [],
    };
  },
  methods: {
    handleSizeChange(val) {
      this.size = val;
      console.log(`每页 ${val} 条`);
      this.selects();
    },
    handleCurrentChange(val) {
      this.page = val;
      console.log(`当前页: ${val}`);
      this.selects();
    },
    //清空
    clears() {
      this.zhanDianAddress = "";
      this.zhanDianChangwenText = "";
      this.ChangwenRang = "";
      this.zhanDianShengxianText = "";
      this.ShengxianRang = "";
      this.zhanDianName = "";
      this.zhanDianPhone = "";
      this.zhanDianPhone1 = "";
    },
    //批量删除
    batch() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteDelete",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      this.selects();
    },
    //添加
    add() {
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/addSite",
        data: {
          site_address: this.zhanDianAddress,
          site_ambient_desc: this.zhanDianChangwenText,
          site_ambient_range: this.ChangwenRang,
          site_ambient_state: 0,
          site_desc: "",
          site_end_time: "",
          site_fresh_desc: this.zhanDianShengxianText,
          site_fresh_range: this.ShengxianRang,
          site_fresh_state: 0,
          site_id: "",
          site_location: "",
          site_name: this.zhanDianName,
          site_phone: this.zhanDianPhone,
          site_spare_phone: this.zhanDianPhone1,
          site_sta: 0,
          site_start_time: "",
          site_state: 0,
        },
      })
        .then((response) => {
          // console.log(response);
          // this.tableData = response.data.data;
        })
        .catch((error) => {
          console.log(error);
        });
      this.selects();
    },
    //修改信息
    updatas() {
      var site_id = window.localStorage.getItem("site_id");
      this.zhandianArr.forEach((element) => {
        if (element.site_id == site_id) {
          this.$axios({
            method: "post",
            url: "/xiaoucomeshome_war/admin/editSite",
            data: {
              site_address: this.zhanDianAddress,
              site_ambient_desc: this.zhanDianChangwenText,
              site_ambient_range: this.ChangwenRang,
              site_ambient_state: 0,
              site_desc: "",
              site_end_time: "",
              site_fresh_desc: this.zhanDianShengxianText,
              site_fresh_range: this.ShengxianRang,
              site_fresh_state: 0,
              site_id: site_id,
              site_location: "",
              site_name: this.zhanDianName,
              site_phone: this.zhanDianPhone,
              site_spare_phone: this.zhanDianPhone1,
              site_sta: 0,
              site_start_time: "",
              site_state: 0,
            },
          })
            .then((response) => {
              // console.log(response);
              // this.zhandianArr = response.data.data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      });
      // this.$forceUpdate();
      this.selects();
      // console.log(id);
    },
    //删除弹出提示框
    psyDelBut(site_id) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          // console.log(id);
          this.deletes(site_id);
          this.selects();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //查看
    chakan(id) {
      window.localStorage.setItem("site_id", id);
      // console.log(id, this.zhandianArr);
      this.zhandianArr.forEach((element) => {
        if (element.site_id == id) {
          this.zhanDianAddress = element.site_address;
          this.zhanDianChangwenText = element.site_ambient_desc;
          this.ChangwenRang = element.site_ambient_range;
          this.zhanDianShengxianText = element.site_fresh_desc;
          this.ShengxianRang = element.site_fresh_range;
          this.zhanDianName = element.site_name;
          this.zhanDianPhone = element.site_phone;
          this.zhanDianPhone1 = element.site_spare_phone;
        }
      });
    },
    //单个删除
    deletes(site_id) {
      // console.log(id);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteDeleteById",
        params: { site_id },
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteQuery",
        data: {
          site_name: this.text,
          page: this.page,
          size: this.size,
        },
      })
        .then((response) => {
          this.total = response.data.total;
          this.zhandianArr = response.data.data;
          // console.log(response.data.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  }, //挂载
  mounted() {
    // this.getzhandianlist();
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.block {
  margin: 0 130px;
  float: right;
}
.head {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100px;
  background-color: rgba(6, 6, 6, 0.1);

  h2 {
    line-height: 100px;
    margin: 0;
    color: #7f7f7f;
  }

  ul {
    position: absolute;
    right: 0;
    bottom: 0;
    overflow: hidden;

    li {
      list-style: none;
      float: left;
      padding: 3px 10px;
    }

    #tuichu {
      border-left: 1px solid black;
      border-right: 1px solid black;
    }
  }
}

.psChaXunSpan {
  width: 20%;
  display: inline-block;
  margin: 5px 2%;
  text-align-last: justify;
}

.searchs {
  margin: 5px 2%;
  width: 72%;
}

.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
</style>
=======
<!--  -->
<template>
  <el-container>
    <!-- 搜索框 -->
    <el-header>
      关键字:<el-input
        class="search"
        type="text"
        @change="selects()"
        placeholder="请输入站点名称"
        v-model="text"
      ></el-input>
    </el-header>
    <!-- 弹出框 -->
    <el-dialog
      class="psyModle"
      title="添加站点"
      :visible.sync="zhanDianAddVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXunSpan">站点名称 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点名称"
        v-model="zhanDianName"
      ></el-input>
      <span class="psChaXunSpan">站点电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="zhanDianPhone"
      ></el-input>
      <span class="psChaXunSpan">站点备用电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入备用电话"
        v-model="zhanDianPhone1"
      ></el-input>
      <span class="psChaXunSpan">站点地址 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点地址"
        v-model="zhanDianAddress"
      ></el-input>
      <span class="psChaXunSpan">常温品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品时效描述"
        v-model="zhanDianChangwenText"
      ></el-input>
      <span class="psChaXunSpan">常温品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品配送范围"
        v-model="ChangwenRang"
      ></el-input>
      <span class="psChaXunSpan">生鲜品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品时效描述"
        v-model="zhanDianShengxianText"
      ></el-input>
      <span class="psChaXunSpan">生鲜品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品配送范围"
        v-model="ShengxianRang"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianAddVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            zhanDianAddVisible = false;
            add();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="编辑站点"
      :visible.sync="zhanDianUPdataVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXunSpan">站点名称 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点名称"
        v-model="zhanDianName"
      ></el-input>
      <span class="psChaXunSpan">站点电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="zhanDianPhone"
      ></el-input>
      <span class="psChaXunSpan">站点备用电话 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入备用电话"
        v-model="zhanDianPhone1"
      ></el-input>
      <span class="psChaXunSpan">站点地址 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入站点地址"
        v-model="zhanDianAddress"
      ></el-input>
      <span class="psChaXunSpan">常温品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品时效描述"
        v-model="zhanDianChangwenText"
      ></el-input>
      <span class="psChaXunSpan">常温品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入常温产品配送范围"
        v-model="ChangwenRang"
      ></el-input>
      <span class="psChaXunSpan">生鲜品时效描述 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品时效描述"
        v-model="zhanDianShengxianText"
      ></el-input>
      <span class="psChaXunSpan">生鲜品配送范围 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入生鲜产品配送范围"
        v-model="ShengxianRang"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianUPdataVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            zhanDianUPdataVisible = false;
            updatas();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="查看信息"
      :visible.sync="zhanDianVisible"
      width="37%"
      top="50px"
      center
    >
      <el-descriptions title="站点信息" :column="2">
        <el-descriptions-item label="站点名称">{{ zhanDianName }}</el-descriptions-item>
        <el-descriptions-item label="站点电话">{{ zhanDianPhone }}</el-descriptions-item>
        <el-descriptions-item label="站点地址">{{ zhanDianAddress }}</el-descriptions-item>
        <el-descriptions-item label="常温品时效描述">{{
          zhanDianChangwenText
        }}</el-descriptions-item>
        <el-descriptions-item label="常温品配送范围">{{ ChangwenRang }}</el-descriptions-item>
        <el-descriptions-item label="生鲜品时效描述">{{
          zhanDianShengxianText
        }}</el-descriptions-item>
        <el-descriptions-item label="生鲜品配送范围">{{ ShengxianRang }}</el-descriptions-item>
      </el-descriptions>

      <span slot="footer" class="dialog-footer">
        <el-button @click="zhanDianVisible = false">取 消</el-button>
        <el-button type="primary" @click="zhanDianVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 显示表 -->
    <el-main>
      <el-row>
        <el-button
          @click="
            zhanDianAddVisible = true;
            clears();
          "
          type="primary"
          title="添加"
          plain
          >添加</el-button
        >
        <el-button @click="batch()" type="danger" title="批量删除" plain>批量删除</el-button>
      </el-row>
      <Maintable :tableData="zhandianArr">
        <template v-slot:tableline>
          <el-table-column prop="site_name" label="站点名称" width="180"> </el-table-column>
          <el-table-column prop="site_address" label="地址" width="180"> </el-table-column>
          <el-table-column prop="site_phone" label="电话" width="180"> </el-table-column>
          <el-table-column prop="site_desc" label="描述" width="180"> </el-table-column>
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="success"
                slot="reference"
                plain
                title="查看"
                @click="
                  chakan(scope.row.site_id);
                  zhanDianVisible = true;
                "
                icon="el-icon-view"
              ></el-button>
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="
                  chakan(scope.row.site_id);
                  zhanDianUPdataVisible = true;
                "
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="psyDelBut(scope.row.site_id)"
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainzhandian",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      isChangwen: false,
      isShengxian: false,
      ChangwenRang: "",
      ShengxianRang: "",
      zhanDianName: "",
      zhanDianPhone: "",
      zhanDianPhone1: "",
      zhanDianAddress: "",
      zhanDianChangwenText: "",
      zhanDianShengxianText: "",
      zhanDianVisible: false,
      zhanDianAddVisible: false,
      zhanDianUPdataVisible: false,
      zhandianArr: [],
    };
  },
  methods: {
    //清空
    clears() {
      this.zhanDianAddress = "";
      this.zhanDianChangwenText = "";
      this.ChangwenRang = "";
      this.zhanDianShengxianText = "";
      this.ShengxianRang = "";
      this.zhanDianName = "";
      this.zhanDianPhone = "";
      this.zhanDianPhone1 = "";
    },
    //批量删除
    batch() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteDelete",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      this.selects();
    },
    //添加
    add() {
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/addSite",
        data: {
          site_address: this.zhanDianAddress,
          site_ambient_desc: this.zhanDianChangwenText,
          site_ambient_range: this.ChangwenRang,
          site_ambient_state: 0,
          site_desc: "",
          site_end_time: "",
          site_fresh_desc: this.zhanDianShengxianText,
          site_fresh_range: this.ShengxianRang,
          site_fresh_state: 0,
          site_id: "",
          site_location: "",
          site_name: this.zhanDianName,
          site_phone: this.zhanDianPhone,
          site_spare_phone: this.zhanDianPhone1,
          site_sta: 0,
          site_start_time: "",
          site_state: 0,
        },
      })
        .then((response) => {
          // console.log(response);
          // this.tableData = response.data.data;
        })
        .catch((error) => {
          console.log(error);
        });
      this.selects();
    },
    //修改信息
    updatas() {
      var site_id = window.localStorage.getItem("site_id");
      this.zhandianArr.forEach((element) => {
        if (element.site_id == site_id) {
          this.$axios({
            method: "post",
            url: "/xiaoucomeshome_war/admin/editSite",
            data: {
              site_address: this.zhanDianAddress,
              site_ambient_desc: this.zhanDianChangwenText,
              site_ambient_range: this.ChangwenRang,
              site_ambient_state: 0,
              site_desc: "",
              site_end_time: "",
              site_fresh_desc: this.zhanDianShengxianText,
              site_fresh_range: this.ShengxianRang,
              site_fresh_state: 0,
              site_id: site_id,
              site_location: "",
              site_name: this.zhanDianName,
              site_phone: this.zhanDianPhone,
              site_spare_phone: this.zhanDianPhone1,
              site_sta: 0,
              site_start_time: "",
              site_state: 0,
            },
          })
            .then((response) => {
              // console.log(response);
              // this.zhandianArr = response.data.data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      });
      // this.$forceUpdate();
      this.selects();
      // console.log(id);
    },
    //删除弹出提示框
    psyDelBut(id) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          // console.log(id);
          this.deletes(id);
          this.selects();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //查看
    chakan(id) {
      window.localStorage.setItem("site_id", id);
      // console.log(id, this.zhandianArr);
      this.zhandianArr.forEach((element) => {
        if (element.site_id == id) {
          this.zhanDianAddress = element.site_address;
          this.zhanDianChangwenText = element.site_ambient_desc;
          this.ChangwenRang = element.site_ambient_range;
          this.zhanDianShengxianText = element.site_fresh_desc;
          this.ShengxianRang = element.site_fresh_range;
          this.zhanDianName = element.site_name;
          this.zhanDianPhone = element.site_phone;
          this.zhanDianPhone1 = element.site_spare_phone;
        }
      });
    },
    //单个删除
    deletes(id) {
      // console.log(id);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteDeleteById",
        data: { site_id: id },
      })
        .then((res) => {
          // console.log(res);
          this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteQuery",
        data: {
          site_name: this.text,
          page: 1,
          size: 8,
        },
      })
        .then((response) => {
          this.zhandianArr = response.data.data;
          // console.log(response.data.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  }, //挂载
  mounted() {
    // this.getzhandianlist();
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.head {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100px;
  background-color: rgba(6, 6, 6, 0.1);

  h2 {
    line-height: 100px;
    margin: 0;
    color: #7f7f7f;
  }

  ul {
    position: absolute;
    right: 0;
    bottom: 0;
    overflow: hidden;

    li {
      list-style: none;
      float: left;
      padding: 3px 10px;
    }

    #tuichu {
      border-left: 1px solid black;
      border-right: 1px solid black;
    }
  }
}

.psChaXunSpan {
  width: 20%;
  display: inline-block;
  margin: 5px 2%;
  text-align-last: justify;
}

.searchs {
  margin: 5px 2%;
  width: 72%;
}

.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
</style>
>>>>>>> ae27e4fe2d4f939d0b0ee2bfa506b9e3269c53cb
